package com.xiyu.service.controller.admin.material;
import com.xiyu.service.vo.material.stock.StockSingleGetByDetailInput;
import com.xiyu.service.vo.material.stock.StockSingleGetByDetailOutput;
import com.xiyu.service.vo.material.stock.StockGetListByDetailOutput;
import com.xiyu.service.vo.material.stock.StockGetListByDetailInput;
import com.xiyu.service.vo.material.stock.StockPageQueryOutput;
import com.xiyu.service.vo.material.stock.StockPageQueryInput;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;

import com.xiyu.service.framework.web.web.core.pojo.PageResult;
import com.xiyu.service.framework.web.web.core.pojo.CommonResult;
import static com.xiyu.service.framework.web.web.core.pojo.CommonResult.success;

import com.xiyu.service.framework.excel.core.util.ExcelUtils;

import com.xiyu.service.framework.operateLog.core.annotations.OperateLog;
import static com.xiyu.service.framework.operateLog.core.enums.OperateTypeEnum.*;

import com.xiyu.service.service.material.StockService;

@Tag(name = "库存管理")
@RestController
@RequestMapping("/material/stock")
@Validated
public class StockController {

    @Resource
    private StockService stockService;

    @GetMapping("/page-query")
    @Operation(summary = "分页查询库存")
    @PreAuthorize("@ss.hasPermission('material:stock:query')")
    public CommonResult<PageResult<StockPageQueryOutput>> pageQuery(@Valid StockPageQueryInput inputVO) {
        return success(stockService.pageQuery(inputVO));
    }

    @PostMapping("/get-list-by-detail")
    @Operation(summary = "批量查询明细")
    public CommonResult<List<StockGetListByDetailOutput>> getListByDetail(@Valid @RequestBody List<StockGetListByDetailInput> inputVO) {
        return success(stockService.getListByDetail(inputVO));
    }

    @GetMapping("/single-get-by-detail")
    @Operation(summary = "获取单个库存明细")
    public CommonResult<StockSingleGetByDetailOutput> singleGetByDetail(@Valid StockSingleGetByDetailInput inputVO) {
        return success(stockService.singleGetByDetail(inputVO));
    }

}
